#include "attackcard.h"
#include "herocard.h"
#include "event.h"
#include <QVariant>

AttackCard::AttackCard(QString name, QObject *parent)
    : EquipmentCard(name, parent)
{
}

void AttackCard::use()
{
    if(hero->attackHorse != NULL)
    {
        hero->game->throwedGameCard.append(hero->attackHorse);
        Event e;
        e.setProperty("equipment", int(hero->attackHorse));
        hero->attackHorse = NULL;
        hero->notifyObserver(&e, hero->loseEquipmentObserver);
    }

    int i = hero->handCard.indexOf(this);
    hero->handCard.removeAt(i);
    hero->attackHorse = this;
}
